<template>
	<view>
		<top name="root">
			<navigator class="top_item" @click="goHome">首页</navigator>
			<navigator class="top_item" @click="goKao">考试安排</navigator>
			<view class="top_search">
				<input type="text" v-model="classNo" placeholder="搜索班级" />
				<view class="" @click="tiao">
					搜索
				</view>
			</view>
		</top>
	</view>
</template>

<script>
	import top from "../top/top.vue"
	export default {
		components:{
			top
		},
		data() {
			return {
				classNo:"",
				havaClass:false,
				indexStuLeftList:['20app1','20app2','20VR1','20VR2','19app1','19app2','19VR1','19VR2','18app1','18app2','18VR1','18VR2','17app1','17app2','17VR1','17VR2']
			}
		},
		methods: {
			goHome(){
				uni.redirectTo({
					 url: '/pages/index/test/test'
				})
			},
			goKao(){
				uni.redirectTo({
				    url: '/pages/index/kao'
				});
			},
			goLogin(){
				uni.redirectTo({
				    url: '/pages/login/login'
				});
			},
			tiao(){
				
				for (let i = 0; i < this.indexStuLeftList.length; i++) {
					if(this.indexStuLeftList[i] == this.classNo){
						uni.redirectTo({
						    url: '/pages/table/table?classNo='+this.classNo
						});
						this.havaClass = true
						break;
					}
				}
				console.log(!this.havaClass)
				if(!this.havaClass){
					uni.showModal({
					    title: '错误',
					    content: '没有此班级',
					    success: function (res) {
					        if (res.confirm) {
					            
					        } else if (res.cancel) {
					           
					        }
					    }
					});
				}
				
			}
		}
	}
</script>

<style>
.top_item{
	margin-bottom: 20rpx;
	color: white;
}
.top_search{
	display: flex;
	justify-content: center;
	color: white;
}
.top_search input{
	border: 1px solid #ACAFB4;
}
</style>
